<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<c:import url="../cabecalho.jsp" />
<c:import url="../menu.jsp" />
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
	<div class="row">
		<ol class="breadcrumb">
			<li>
				<a href="#">
					<span class="glyphicon glyphicon-home"></span>
				</a>
			</li>
			<li class="active">
				<fmt:message key="manual.servico" />
			</li>
		</ol>
	</div>
	<div class="row">
		<div class="col-lg-12">
			<h1 class="page-header">
				<fmt:message key="manual.servico" />
			</h1>
		</div>
	</div>
	<c:url value="/resources/img/pdf.png" var="pdfImage" />
	<div class="row">
		<div class="col-lg-10 col-md-10">
			<div class="panel panel-default">
				<div class="panel-heading cab">
					<fmt:message key="manual.servico" />
				</div>
				<div class="panel-body">
					<form action="manuaisProdutos">
						<div class="col-md-12 col-lg-12">
							<div class="form-group col-md-11 col-lg-11">
								<label for="nome">
									<fmt:message key="nome.produto" />
								</label>
								<input type="text" class="form-control" name="nome" id="nome" value="">
							</div>
							<div class="form-group col-md-1 col-lg-1">
								<button id="w-button-search" type="submit" class="btn btn-primary direita">
									<fmt:message key="consultar" />
								</button>
							</div>
						</div>
					</form>
				</div>
				<div class="panel-body">
					<table class="table table-hover">
						<c:forEach items="${listaManuais}" var="manual">
							<tr>
								<td>
									<a href="consultaManual?codigo=${manual.codigo}">
										<img class="imagemPdf" src="${pdfImage}" />
									</a>
								</td>
								<td style="text-align: left; padding-top: 13px;">
									<a href="consultaManual?codigo=${manual.codigo}">${manual.nome}</a>
								</td>
							</tr>
						</c:forEach>
					</table>
				</div>
			</div>
		</div>
	</div>
	<input type="hidden" name="temErroForm" id="temErroForm" value="${not empty msg && msg.tipo eq 'erro' ? 'sim' : 'nao'}" />
</div>
<script>
	$(document)
			.ready(
					function() {
						$('#nome')
								.autocomplete(
										{
											serviceUrl : '${pageContext.request.contextPath}/seguro/asc/getManuais',
											paramName : "nome",
											delimiter : ",",
											transformResult : function(response) {
												return {
													suggestions : $
															.map(
																	$
																			.parseJSON(response),
																	function(
																			item) {
																		return {
																			value : item.nome,
																			data : item.codigo
																		};
																	})
												};
											}
										});
					});
</script>
<c:import url="../rodape.jsp" />
